var a = require("../../services/api.js");
var app = getApp()
Page({
  data: {
    info: {},
    realname: "",
    alipay: ""
  },
  onLoad: function(n) {
    wx.request({
      url: app.globalData.hosts + "/xcxapi/getmember",
      header: {
        'Cookie': 'PHPSESSID=' + app.globalData.sessionId
      },
      data: {
        id: app.globalData.member_id
      },
      success: (res) => {
        this.setData({
          realname: res.data.data.realname,
          alipay: res.data.data.alipay,
        })
      },
    });
  },
  nameInput: function(a) {
    this.setData({
      realname: a.detail.value
    });
  },
  accountInput: function(a) {
    this.setData({
      alipay: a.detail.value
    });
  },

  // 修改支付宝 用户名
  send() {
    var that = this;
    var n = this.data;
    wx.request({
      url: app.globalData.hosts + "/xcxapi/update",
      header: {
        'Cookie': 'PHPSESSID=' + app.globalData.sessionId
      },
      data: {
        id: app.globalData.member_id,
        realname: n.realname,
        alipay: n.alipay
      },
      success: (res) => {

        wx.showToast({
          title: "提交成功",
          mask: !0,
          duration: 1500
        });

        wx.navigateTo({
          url: '/pages/set/index',
        });


      },
      fail() {
        wx.showToast({
          title: '修改失败',
          icon: 'loading'
        })
      }
    });
  },
  onReady: function() {},
  onShow: function() {},
  onHide: function() {},
  onUnload: function() {},
  onPullDownRefresh: function() {},
  onReachBottom: function() {},
  onShareAppMessage: function() {}
});